
export function formatNumberToThounsands(num:number){
    if(isNaN(num) || (typeof(num))!=='number'){
        throw new Error('必须是数字类型')
    }
    const [integerPart,decimalPart] = num.toString().split('.')
    let formartNumber = ''
    for(let i=integerPart?.length-1;i>=0;i--){
        formartNumber = integerPart[i] + formartNumber
        if((integerPart?.length-i)%3===0 && i!==0){
            formartNumber = ',' + formartNumber
        }
    }
    return decimalPart?`${formartNumber}.${decimalPart}`:formartNumber
}